package com.xf.common.core.enums;

/**
 * 数据状态枚举
 * @author Administrator
 */
public enum StateEnum {
    ENABLE(1, "启用"),
    DISABLE(0, "停用"),
    ;

    private int code;
    private String desc;

    StateEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static StateEnum parse(int type) {
        for (StateEnum operationEnum : StateEnum.values()) {
            if (operationEnum.getCode() == type) {
                return operationEnum;
            }
        }
        return null;
    }

}
